package com.kelvin.paopao.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kelvin.kelvinlib.imageloader.GlideUtil;
import com.kelvin.paopao.R;
import com.kelvin.paopao.api.responseBean.NearByPersonModel;

/**
 * Created by MCK on 2017/5/8.
 */

public class MainFindAdapter2 extends BaseQuickAdapter<NearByPersonModel, BaseViewHolder> {
    private Context context;

    public MainFindAdapter2(Context context) {
        super(R.layout.recycler_person_item);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, NearByPersonModel item) {
        ImageView iv = helper.getView(R.id.iv_touxiang);
        GlideUtil.loadCommonImg(item.getUser_headimg(),
                R.drawable.default_img, iv, context);
        helper.setText(R.id.tv_date, item.getOnline_location());
        helper.setText(R.id.tv_detail, item.getUser_qianming());
        helper.setText(R.id.tv_name, item.getUser_name());
        if (item.getUser_sex() == 1) {
            helper.setImageResource(R.id.iv_gender, R.drawable.icon_male_color);
        } else {
            helper.setImageResource(R.id.iv_gender, R.drawable.icon_female_color);
        }
    }
}
